def singleton(cls):
    instance = {}
    def getInstance(*args, **kwargs):
        if cls not in instance:
            instance[cls] = cls(*args, **kwargs)
        return instance[cls]
    return getInstance
@singleton
class Card(object):
    pass
@singleton
class Person(object):
    pass

c1 = Card()
c2 = Card()
print(c1 is c2)

p1 = Person()
p2 = Person()
print(p1 is p2)